﻿<Window x:Class="XQueryConsole.PreferencesDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Preferences" Height="270" Width="396" WindowStartupLocation="CenterOwner" ResizeMode="NoResize"
        xmlns:w="clr-namespace:XQueryConsole" ShowInTaskbar="False"
        TextOptions.TextFormattingMode="Display">
    <Grid Margin="3,2,5,0">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <TabControl Name="OptionTab" Margin="2,3,0,0">
            <TabItem Header="General">
                <StackPanel Orientation="Vertical">
                    <GroupBox Header="Appearance" Height="73" Width="250" 
                          HorizontalAlignment="Left" VerticalAlignment="Top"
                          Margin="3,5,0,0">
                        <StackPanel Orientation="Vertical">
                            <StackPanel.Resources>
                                <w:EnumToBooleanConverter x:Key="EnumToBooleanConverter" />
                            </StackPanel.Resources>
                            <RadioButton Name="SQLPanelButton" Margin="2,8,0,0" 
                                     IsChecked="{Binding RelativeSource={RelativeSource AncestorType=w:PreferencesDialog}, 
                                        Path=DefaultPanel, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static w:StartupPanel.SQL}}">
                                SQL panel opens at startup</RadioButton>
                            <RadioButton Name="XQueryPanelButton" Margin="2,5,0,0"
                                     IsChecked="{Binding RelativeSource={RelativeSource AncestorType=w:PreferencesDialog}, 
                                        Path=DefaultPanel, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static w:StartupPanel.XQuery}}">
                                XQuery panel opens at startup</RadioButton>
                        </StackPanel>
                    </GroupBox>
                    <CheckBox Margin="5,8,0,0" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=w:PreferencesDialog}, 
                        Path=EnableServerQuery}">Enable server query</CheckBox>
                    <CheckBox Margin="5,8,0,0" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=w:PreferencesDialog}, 
                        Path=LimitSQLQueryResults}">Limit Query results by 100 rows</CheckBox>
                </StackPanel>
            </TabItem>
            <TabItem Header="Folders">
                <StackPanel Grid.Row="0" Orientation="Vertical">
                    <Label>Search Path:</Label>
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="searchPathTextBox" Margin="5,0,0,0" Width="320" Text="{Binding RelativeSource={RelativeSource AncestorType=w:PreferencesDialog}, 
                    Path=SearchPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
                        <Button Width="24" Name="button1" Click="Button1_Click">
                            <TextBlock FontWeight="Bold">...</TextBlock>
                        </Button>
                    </StackPanel>
                    <Label Margin="0,5,0,0">My Queries Location:</Label>
                    <StackPanel Orientation="Horizontal">
                        <TextBox Name="queriesFolderTextBox"  Margin="5,0,0,0" Width="320" Text="{Binding RelativeSource={RelativeSource AncestorType=w:PreferencesDialog}, 
                    Path=MyQueriesPath, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox>
                        <Button Width="24" Name="button2" Click="Button2_Click">
                            <TextBlock FontWeight="Bold">...</TextBlock>
                        </Button>
                    </StackPanel>
                </StackPanel>
            </TabItem>
        </TabControl>
        <StackPanel Grid.Row="1" Orientation="Horizontal" 
                    HorizontalAlignment="Right" Margin="0,5,0,10">
            <Button Width="80" IsDefault="True" Click="ButtonOK_Click">OK</Button>
            <Button Width="80" IsCancel="True" Margin="5,0,0,0">Cancel</Button>
        </StackPanel>
    </Grid>
</Window>
